package org.example.t0526;

import java.util.concurrent.locks.LockSupport;

public class T1 {

    static Thread t1 =null ,t2= null;
    public static void main(String[] args) {

        char [] a1 = "1234567".toCharArray();
        char [] a2 = "ABCDEFG".toCharArray();

        t1 = new Thread(()->{
            for(char a  : a1){
                System.out.print(a);
                LockSupport.unpark(t2);
                LockSupport.park();

            }

        },"t1");
        t2 = new Thread(()->{
            for(char a  : a2){
                LockSupport.park();
                System.out.print(a);
                LockSupport.unpark(t1);
            }

        },"t2");

        t1.start();
        t2.start();

    }


}
